#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include<QQmlContext>
#include"dataobject.h"
#include"abstractlistmodel.h"
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    QStringList a;
    a<<"Bill Smith"<<"John Brown"<<"Sam Wise";            //QStringList model
    QList<QObject*> dataList;                                    //QObject model
    dataList<<new DataObject("Bill Smith","red","555 3264")<<new DataObject("John Brown","green","555 8426")
           <<new DataObject("Sam Wise","blue","555 0473");

    AbstractListModel listmodel;
    listmodel.addList(AbstractList("Bill Smith","red","555 3264"));
    listmodel.addList(AbstractList("John Brown","green","555 8426"));
    listmodel.addList(AbstractList("Sam Wise","blue","555 0473"));
    QQmlApplicationEngine engine;
    engine.rootContext()->setContextProperty("name1",QVariant::fromValue(a));
    engine.rootContext()->setContextProperty("myObjectModel",QVariant::fromValue(dataList));
    engine.rootContext()->setContextProperty("myModel",&listmodel);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}
